<?php
$this->widget(
	'library\widgets\BreadCrumbs', 
	array('index', 'posts')
);
?>

<?php $this->widget('library\widgets\Tips'); ?>

<div>
<?php
echo $this->getHtml()->a('添加', $this->util->getUrlByCtrl('add'), array(
	'class' => 'button black medium bigrounded'
));
?>

<?php
echo $this->getHtml()->button('批量放入回收站', 'button', array(
	'class' => 'button black medium bigrounded',
	'onclick' => 'return batchRecycle(\'' . $this->util->getUrlByCtrl('edit_submit', array('status' => 't')) . '\', \'确定放入回收站？\');'
));
echo $this->getHtml()->button('批量开放浏览', 'button', array(
	'class' => 'button black medium bigrounded',
	'onclick' => 'return batchRecycle(\'' . $this->util->getUrlByCtrl('edit_submit', array('status' => 'o')) . '\', \'确定开放浏览？\');'
));
echo $this->getHtml()->button('批量改为待审核', 'button', array(
	'class' => 'button black medium bigrounded',
	'onclick' => 'return batchRecycle(\'' . $this->util->getUrlByCtrl('edit_submit', array('status' => 'c')) . '\', \'确定改为待审核？\');'
));
?>
<?php require_once 'posts_search.php'; ?>
</div>

<?php
$this->widget(
	'library\widgets\TableBuilder',
	array(
		'columns' => array(
			'toggle' => array(
				'label' => $this->getHtml()->checkbox('toggle', 'post_ids[]'),
				'type' => 'checkbox',
				'attributes' => array(
					'width' => '20',
				),
				'value' => $this->getHtml()->checkbox('post_ids[]', '__post_id__'),
				'replace' => 'post_id'
			),
			'post_title',
			'category_id' => array(
				'attributes' => array(
					'width' => '8%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Categories', 'post'), 'getNameById')
			),
			'admin_id' => array(
				'attributes' => array(
					'width' => '6%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Admins', 'admin'), 'getLoginNameById')
			),
			'is_html' => array(
				'attributes' => array(
					'width' => '6%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Posts', 'post'), 'getIsHtmlLabel')
			),
			'post_status' => array(
				'attributes' => array(
					'width' => '6%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Posts', 'post'), 'getPostStatusLabel')
			),
			'access_count' => array(
				'attributes' => array(
					'width' => '2%',
					'nowrap' => 'nowrap'
				)
			),
			'dt_created' => array(
				'attributes' => array(
					'width' => '13%',
					'nowrap' => 'nowrap'
				)
			),
			'dt_modify' => array(
				'attributes' => array(
					'width' => '13%',
					'nowrap' => 'nowrap'
				)
			),
			'post_id' => array(
				'label' => 'ID',
				'attributes' => array(
					'width' => '1%',
					'nowrap' => 'nowrap'
				)
			),
			'__operate__' => array(
				'name' => 'post_status',
				'label' => '操作',
				'attributes' => array(
					'width' => '18%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Posts', 'post'), 'getOperateLabel'),
				'addonname' => 'post_id',
			)
		),
		'form' => $this->util->getForm('Posts', 'post'),
		'data' => $this->data,
		'page' => $this->page
	)
);
?>

<?php
echo $this->getHtml()->js('attachToggle();');
?>
